<%@ page contentType="text/html; charset=utf-8" %>
<%@taglib prefix="s" uri="/struts-tags" %>
<html>
<head>
<title>栏目列表</title>
<link rel="stylesheet" href="${pageContext.request.contextPath}/css/admin.css" type="text/css">
<link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/css/themes/default/easyui.css">
<link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/css/themes/icon.css">
<link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/css/style.css">
<script type="text/javascript" src="${pageContext.request.contextPath}/js/jquery-1.8.0.min.js"></script>  
<script type="text/javascript" src="${pageContext.request.contextPath}/js/jquery.easyui.min.js"></script>  
<script type="text/javascript" src="${pageContext.request.contextPath}/js/easyui-lang-zh_CN.js" charset="utf-8"></script>
<script type="text/javascript">
function removeThis(imoduleid){
	if(confirm('您确定要删除吗?')){
		var infoCnt = 0;
		jQuery.ajax({
			type:'post',
			url:'${pageContext.request.contextPath}/back/findInfoRecordByImoduleId.html',
			data:{'obj.imoduleid':imoduleid},
			async:false,
			success:function(json){
				infoCnt = json.cnt;
			},
			error:function(){
				infoCnt = -1;
			}
		});
		if(infoCnt==-1){
			alert('网络出现异常，请稍后重试!');
			return false;
		}else if(infoCnt>0){
			alert('该栏目下还有'+infoCnt+'条新闻信息，请先处理!');
			return false;
		}else{
			jQuery.ajax({
				type:'post',
				url:'${pageContext.request.contextPath}/back/deleteByImoduleId.html',
				data:{'obj.imoduleid':imoduleid},
				async:false,
				success:function(json){
					if(json.cnt>0){
						alert('删除栏目成功');
						window.location.href='${pageContext.request.contextPath}/back/moduleLst.html';
					}
				},
				error:function(){
					alert('删除栏目失败');
				}
			});
			
		}
	}
}
</script>
</head>

<body>
<table border=0 width="90%" cellspacing="0" cellpadding="0" align="center">
<tr height=28>
<td><u>新闻栏目</u></td>
</tr>
<tr height=10>
<td></td>
</tr>
<tr height=35>
<td align="left"><a href="${pageContext.request.contextPath}/back/moduleAdd.html" class="easyui-linkbutton" >增加栏目</a></td>
</tr>
</table>
<s:form action="moduleLst.html" method="POST">
 <div >
	<table id="tab1" border="0" cellspacing="1" cellpadding="0" style="text-align: center;width: 90%;" bgcolor="#a8c7ce" align="center">
	  <tr bgcolor="#e8f0f8" height="25">
	   	<td width="4%">&nbsp;</td>
        <td>栏目名称</td>
        <td width="50">级别</td>
        <td width="100">操作</td>
      </tr>
       <s:iterator id="lst" value="lst" status="ls">
     	<tr bgcolor="#ffffff" height="25">
     		<td><s:property value="%{#ls.index+1+(pageInfo.pageSize*(pageInfo.pageIndex-1))}"/></td>
     		<td>
				<s:property value="smodulename"/>
			</td>
     		<td>
     			<s:property value="iorder"/>
     		</td>
     		<td>
     			<a href="###" onclick="removeThis('${imoduleid}')">删除</a>
     			<a href="${pageContext.request.contextPath}/back/moduleEdit.html?obj.imoduleid=${imoduleid}">修改</a>
     		</td>
     	</tr>
      </s:iterator>
	</table>
 </div>
 <div style="width: 90%;margin: 0 auto;"><jsp:include page="../footer.jsp"></jsp:include></div>
</s:form>	

</body>
</html>